<?php

defined('SYSPATH') or die('Access error!');

class Controller_Tag extends Controller_Q2a_Main
{

    private $tag;

    public function before()
    {
        parent::before();
        $this->tag = Model_Q2a_Tag::factory('q2a_tag');
        I18n::set_current_file('question');
    }

    public function action_list()
    {
        $id = intval($this->request->param('id'));
        $category_detail = Model_Category::factory('category')->get_row(array('id' => $id), 'id,name');
        //当前位置
        Breadcrumbs::add('标签大全', URL::site() . 'tag/list/');
        if (count($category_detail) > 0)
        {
            Breadcrumbs::add($category_detail['name'], URL::site() . 'tag/list/' . $id);
            $this->template->assign('category_detail', $category_detail);
        }
        $tag_list = $this->tag->get_tag_list($id);
        $this->template->assign('current_position', Breadcrumbs::render());

        $this->template->assign('tag_list', $tag_list);
        $this->template->view('tag_list');
    }

}